<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>

  <body>
    <script>
      //剩余参数
      const sum = (...args) => {
        let total = 0;
        args.forEach((item) => {
          total += item;
        });
        return total;
      };
      console.log(sum(10, 20));
      console.log(sum(10, 20, 30));

      // 解构
      let obj = ["zks", 18, "男"];
      let s1 = [...obj];
      console.log(s1);

      let newobj = {
        name: "zks",
        age: 18,
        gender: "男",
      };

      let { name, ...value } = newobj;

  console.log(name,value);

      let newobj2 = { ...newobj, name: "zzzzzzzzzz" };
      console.log(newobj2);
      //新对象结构

      let userobj = [
        {
          name: "zks",
          age: 18,
          password: "123",
        },
        {
          name: "zksdfss",
          age: 158988,
          password: "123asd",
        },
      ];

      let zzzobj = [...userobj];

      console.log(...zzzobj);
    </script>
  </body>
</html>
